package com.platform.enums.formatters;

import com.platform.enums.FunctionType;
import org.springframework.format.Formatter;

import java.text.ParseException;
import java.util.Locale;

/**
 * Description: 菜单类型枚举转换-MVC
 *
 * @author libin Created on 2019/7/24
 **/
public class FunctionTypeFormatter implements Formatter<FunctionType> {
    @Override
    public FunctionType parse(String text, Locale locale) throws ParseException {
        return FunctionType.getByValue(text);
    }

    @Override
    public String print(FunctionType object, Locale locale) {
        return object.getValue();
    }
}
